package com.swust.excel.write.onesheet;

import com.alibaba.excel.EasyExcel;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

/**
 * @author: Chen Yixing
 * @since: 2023/11/16 16:35:00
 * @description:
 */
public class WriteOneMain {

    public static void main(String[] args) {
        // 这里 需要指定写用哪个class去写，然后写到第一个sheet，名字为模板 然后文件流会自动关闭
        EasyExcel.write("D:/data/onesheet.xlsx", WriteOneBean.class).sheet("模板").doWrite(data());
    }

    private static List data() {
        List<WriteOneBean> list = new ArrayList<>();
        for (int i = 0; i < 6; i++) {
            list.add(new WriteOneBean("" + i, UUID.randomUUID().toString()));
        }
        return list;
    }
}
